package simulator;
import java.util.Timer;
import java.util.TimerTask;
import cartago.Artifact;


public class ArtTimer extends Artifact{
	int milisseconds=1000;
    
	void init() {
		 Timer timer = new Timer("Printer");
		 MyTask t = new MyTask();
		 timer.schedule(t, 0, milisseconds);
	}
	
}
class MyTask extends TimerTask {
	protected int ticks = 0;
    public void run() {
    	ticks++;
   	//conta o numero de lixo para colocar nas series
		int count_garb_0=0;
		for(int j=0;j<FildGrid.garbages.size();j++){
			if(FildGrid.garbages.get(j).getType()==0){
				count_garb_0++;
			}
		}
		InterfaceFrame.addSeries0(ticks,count_garb_0);//numero de lixo 0
		InterfaceFrame.addSeries1(ticks,FildGrid.garbages.size()-count_garb_0);//numero de lixo 1
		InterfaceFrame.addSeries2(ticks,10);
		InterfaceFrame.addUpdateDatasetPies();
    }
}